package com.example.shop_car_2208.fragment

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.shop_car_2208.entity.AddCarResult
import com.example.shop_car_2208.entity.UpDateIconResult
import com.example.shop_car_2208.mvvm.BaseViewModel
import kotlinx.coroutines.launch
import okhttp3.MultipartBody

class MyViewModel:BaseViewModel() {
    val success = MutableLiveData<UpDateIconResult>()
    val fail = MutableLiveData<String>()
    fun updateIcon(part:MultipartBody.Part){
        viewModelScope.launch {
            try {
                success.value = apiService.updateIcon(part)
            }catch (e:Exception){
                fail.value = e.message
            }
        }
    }
}